<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Java实训课程 - 统计</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="libs/bootstrap-3.3.6/css/dropzone.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js"></script>
<script src="libs/getQueryString.js"></script>
<script src="libs/js.cookie-2.1.0.min.js"></script>
<script src="libs/jquery.backstretch.min.js"></script>
<script src="libs/dropzone.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-md-12 page-header">
				<h2>
					个人档案详情
					<button id="querynull" class="btn btn-primary pull-right">退出</button>
				</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="col-md-8">
			<ul class="nav nav-pills">
				<li><a href="index.html">首页</a></li>
				<li><a href="#">用户：<span id="nickname"></span></a></li>
			</ul>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<hr />
			</div>
		</div>
	</div>
	<div class="container">
		<!-- Nav tabs -->
		<ul class="nav nav-tabs" role="tablist">
			<li role="presentation" class="active"><a href="#home"
				aria-controls="home" role="tab" data-toggle="tab">1</a></li>
			<li role="presentation"><a href="#profile"
				aria-controls="profile" role="tab" data-toggle="tab">2</a></li>
			<li role="presentation"><a href="#messages"
				aria-controls="messages" role="tab" data-toggle="tab">3</a></li>
		</ul>

		<!-- Tab panes -->
		<div class="tab-content">
			<div role="tabpanel" class="tab-pane active" id="home">
				<div class="panel-body" id="list1">
					<div class="container">
						<h1>
							<div class="row">
								<div class="col-md-8">
									<table border="2px">
										<tr>
											<td><strong>id:</strong></td>
											<td><input id="id" readonly="readonly" /></td>
										</tr>
										<tr>
											<td><strong>档案号：</strong></td>
											<td><input id="archive_id" readonly="readonly" /></td>
										</tr>
										<tr>
											<td><strong>身份证号：</strong></td>
											<td><input id="identity" readonly="readonly" /></td>
										</tr>
										<tr>
											<td><strong>姓名：</strong></td>
											<td><input id="name" /></td>
										</tr>
										<tr>
											<td><strong>性别:</strong></td>
											<td><input id="gender" /></td>
										</tr>
										<tr>
											<td><strong>出生日期:</strong></td>
											<td><input id="birthday" /></td>
										</tr>
										<tr>
											<td><strong>预退休日期:</strong></td>
											<td><input id="date_retire1" /></td>
										</tr>
										<tr>
											<td><strong>实际退休日期:</strong></td>
											<td><input id="date_retire2" /></td>
										</tr>
										<tr>
											<td><strong>特殊工种:</strong></td>
											<td><input id="sp" /></td>
										</tr>
										<tr>
											<td><strong>女管理岗位:</strong></td>
											<td><input id="fc" /></td>
										</tr>
										<tr>
											<td><strong>职称：</strong></td>
											<td><input id="title" /></td>
										</tr>
										<tr>
											<td><strong>工龄：</strong></td>
											<td><input id="seniority" /></td>
										</tr>
									</table>
									<div class="col-md-6">
										<button id="update" class="btn btn-primary">修改</button>
									</div>
								</div>
							</div>
						</h1>
					</div>
				</div>
			</div>
			<div role="tabpanel" class="tab-pane" id="profile">
				<div class="panel-body" id="file1"></div>
			</div>
			<div role="tabpanel" class="tab-pane" id="messages">
				<form id="Form" action="" METHOD="POST"
					enctype="multipart/form-data">
					<input type="file" name="file" />
					<button type="submit">提交</button>
				</form>
				<form id="dropzone" action="" class="dropzone" method="post"></form>
			</div>
		</div>
	</div>

	<script type="text/x-handlebars-template" id="template">
    {{#each item}}
    <div class="panel panel-default col-md-3">
      <div class="panel-body" >
        <div class="thumbnail">
          <a href="querydel.html?id={{id}}"><img src="upload/{{archive_id}}/{{name}}" /></a>
        </div>
     </div>
   </div>
   {{/each}}
 </script>
</body>
<script type="text/javascript">
	$(function() {
		var id = getQueryString('id');
		var url = 'query_one.action?id=' + id;
		$.getJSON(url, function(res) {
			console.log(res[0].id);
			$('#id').val(res[0].id);
			$('#archive_id').val(res[0].archive_id);
			$('#identity').val(res[0].identity);
			$('#name').val(res[0].name);
			$('#gender').val(res[0].gender);
			$('#birthday').val(res[0].birthday);
			$('#date_retire1').val(res[0].date_retire1);
			$('#date_retire2').val(res[0].date_retire2);
			$('#sp').val(res[0].sp);
			$('#fc').val(res[0].fc);
			$('#title').val(res[0].title);
			$('#seniority').val(res[0].seniority);
		})
	})
</script>
<script type="text/javascript">
	if (!Cookies.get("users")) {
		window.location.href = 'login.html';
	}
	$('#myTabs a').click(function(e) {
		e.preventDefault()
		$(this).tab('show')
	})
</script>
<script type="text/javascript">
	$(function() {
		var id = getQueryString('id');
		var url = 'update.action?id=' + id;
		$('#update').click(function() {
			$.post(url, {
				archive_id : $('#archive_id').val(),
				identity : $('#identity').val(),
				name : $('#name').val(),
				gender : $('#gender').val(),
				birthday : $('#birthday').val(),
				date_retire1 : $('#date_retire1').val(),
				date_retire2 : $('#date_retire2').val(),
				sp : $('#sp').val(),
				fc : $('#fc').val(),
				title : $('#title').val(),
				seniority : $('#seniority').val(),
			}, function(res, status) {
				if ('OK' == res) {
					window.location.href = 'index.html';
				}
			})
		})
	})
</script>

<script type="text/javascript">
	$(function() {
		var id = getQueryString('id');
		$('#Form').attr('action', id + '/upload.action');
	})
</script>

<script type="text/javascript">
	var id = getQueryString('id');
	Dropzone.options.dropzone = {
		url : id + '/upload.action',
		clickable : true,
		acceptedFiles : '.jpg',
		dictDefaultMessage : '拖放图片文件到此位置',
		dictInvalidFileType : '错误的文件类型',
		dictFileTooBig : '文件过大',
		dictResponseError : '与服务器连接失败',
		dictCancelUpload : '已取消',
		dictCanceluploadConfirmation : '确认取消上传'
	}
</script>

<script type="text/javascript">
	$(function() {
		var id = getQueryString('id');
		var url = 'queryFile.action?id=' + id;
		$.getJSON(url, function(res) {
			var data = {
				'item' : res
			};
			var t = Handlebars.compile($('#template').html());
			$('#file1').html(t(data));
		})
	})
</script>

<script type="text/javascript">
	$(function() {
		$.getJSON('querynick.action', function(res) {
			$('#nickname').text(res.nick);
		})
	})
</script>
<script type="text/javascript">
	$(function() {
		$.backstretch("image/3.jpg")
	})
</script>
</html>